{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "5e42f89b",
   "metadata": {},
   "outputs": [],
   "source": [
    "import jqdatasdk\n",
    "from jqdatasdk import auth, get_price, get_all_securities\n",
    "get_all_securities?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "e261ddd9",
   "metadata": {},
   "outputs": [],
   "source": [
    "auth('xxx', 'xxx.xxx')\n",
    "get_price?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "c45fc5af",
   "metadata": {},
   "outputs": [],
   "source": [
    "df = get_all_securities(['stock', 'etf', 'index', 'futures'])\n",
    "df.to_csv('contract.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "2d156e5b",
   "metadata": {},
   "outputs": [],
   "source": [
    "df = get_price(['600036.XSHG', '000001.XSHG', '000002.XSHE',\n",
    "                'LH2203.XDCE'\n",
    "               ], start_date='2021-01-01', end_date='2022-02-10', panel=False,frequency='daily')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "6ead8c83",
   "metadata": {},
   "outputs": [],
   "source": [
    "df.to_csv('bar_daily.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "014ace33",
   "metadata": {},
   "outputs": [],
   "source": [
    "df = get_price(['600036.XSHG', '000001.XSHG', '000002.XSHE',\n",
    "                'LH2203.XDCE'\n",
    "               ], start_date='2022-01-20', end_date='2022-02-10', panel=False,frequency='1m')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "7e4d4886",
   "metadata": {},
   "outputs": [],
   "source": [
    "df.to_csv('bar_minute.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c61b09c7",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
